home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / GNU_KIT / DISK6.ZIP / gnu / man / cat1 / find.1 < prev    next >
Encoding:
Text File  |  1994-01-19  |  16.8 KB  |  397 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. FIND(1L) FIND(1L)
  8. NAME
  9.      find - search for files in a directory hierarchy
  10. SYNOPSIS
  11.      find [path...] [expression]
  12. DESCRIPTION
  13.      This manual page documents the GNU version of find.  find
  14.      searches the directory tree rooted at each given pathname by
  15.      evaluating the given expression from left to right, accord-
  16.      ing to the rules of precedence (see section OPERATORS),
  17.                                                           ___      until the outcome is known (left hand side false for and
  18.                           __                                        operations, true for or), at which point find moves on to
  19.      the next pathname.
  20.      The first argument that begins with `-', `(', `)', `,', or
  21.      `!' is taken to be the beginning of the expression; any
  22.      arguments before it are paths to search, and any arguments
  23.      after it are the rest of the expression.  If no paths are
  24.      given, the current directory is used.  If no expression is
  25.      given, the expression `-print' is used.
  26.      find exits with status 0 if all files are processed success-
  27.      fully, greater than 0 if errors occur.
  28. EXPRESSIONS
  29.      The expression is made up of options (which affect overall
  30.      operation rather than the processing of a specific file, and
  31.      always return true), tests (which return a true or false
  32.      value), and actions (which have side effects and return a
  33.      true or false value), all separated by operators.  -and is
  34.      assumed where the operator is omitted.  If the expression
  35.      contains no actions other than -prune, -print is performed
  36.      on all files for which the expression is true.
  37.      OPTIONS
  38.      -daystart
  39.           Measure times (for -amin, -atime, -cmin, -ctime, -mmin,
  40.           and -mtime) from the beginning of today rather than
  41.           from 24 hours ago.
  42.      -depth
  43.           Process each directory's contents before the directory
  44.           itself.
  45.      -follow
  46.           Dereference symbolic links.
  47.                ______      -maxdepth levels
  48.                           ______                                           Descend at most levels (a non-negative integer) levels
  49.           of directories below the command line arguments.
  50. Page 1
  51. FIND(1L) FIND(1L)
  52.           `-maxdepth 0' means only apply the tests and actions to
  53.           the command line arguments.
  54.                ______      -mindepth levels
  55.           Do not apply any tests or actions at levels less than
  56.           ______                                                          levels (a non-negative integer).  `-mindepth 1' means
  57.           process all files except the command line arguments.
  58.      -version
  59.           True; print find version number on standard error.
  60.      -xdev
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           True; don't descend directories on other filesystems.
  74.      TESTS
  75.      Numeric arguments can be specified as
  76.       _                  _       +n for greater than n,
  77.       _               _       -n for less than n,
  78.      _             _       n for exactly n.
  79.            _      -amin n
  80.                                  _                        File was last accessed n minutes ago.
  81.              ____      -anewer file
  82.                                                     ____               File was last accessed more recently than file was
  83.           modified.  -anewer is affected by -follow only if -fol-
  84.           low comes before -anewer on the command line.
  85.             _      -atime n
  86.                                  _                         File was last accessed n*24 hours ago.
  87.            _      -cmin n
  88.                                          _                        File's status was last changed n minutes ago.
  89.              ____      -cnewer file
  90.                                                             ____           File's status was last changed more recently than file
  91.           was modified.  -cnewer is affected by -follow only if
  92.           -follow comes before -cnewer on the command line.
  93.             _      -ctime n
  94.                                          _                         File's status was last changed n*24 hours ago.
  95.      -empty
  96.           File is empty and is either a regular file or a direc-
  97.           tory.
  98.      -false
  99.           Always false.
  100. Page 2
  101. FIND(1L) FIND(1L)
  102.              ____      -fstype type
  103.                                           ____                      File is on a filesystem of type type. The valid
  104.           filesystem types vary among different versions of Unix;
  105.           an incomplete list of filesystem types that are
  106.           accepted on some version of Unix or another is: ufs,
  107.           4.2, 4.3, nfs, tmp, mfs, S51K, S52K.
  108.           _      -gid n
  109.                                      _            File's numeric group ID is n.
  110.             _____      -group gname
  111.                                 _____                                       File belongs to group gname (numeric group ID allowed).
  112.            _      -inum n
  113.                                 _            File has inode number n.
  114.             _      -links n
  115.                    _                  File has n links.
  116.             _______      -lname pattern
  117.           File is a symbolic link whose contents match shell pat-
  118.                _______                                                  tern pattern. `*' and `?' match `.' at the start of
  119.           the link contents.  Slash characters have no special
  120.           meaning in the comparison.
  121.            _      -mmin n
  122.                                         _                        File's data was last modified n minutes ago.
  123.             _      -mtime n
  124.                                         _                         File's data was last modified n*24 hours ago.
  125.            _______      -name pattern
  126.           Base of path name (the path with the leading direc-
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                                                 _______                    tories removed) matches shell pattern pattern. `*' and
  140.           `?' do not match `.' at the start of the filename.
  141.             ____      -newer file
  142.                                                ____                      File was modified more recently than file. -newer is
  143.           affected by -follow only if -follow comes before -newer
  144.           on the command line.
  145.      -nouser
  146.           No user corresponds to file's numeric user ID.
  147.      -nogroup
  148.           No group corresponds to file's numeric group ID.
  149.            ____      -perm mode
  150.                                              ____                          File's permission bits are exactly mode (octal or sym-
  151.           bolic).
  152.             ____      -perm -mode
  153. Page 3
  154. FIND(1L) FIND(1L)
  155.                           ____                                 Permission bits mode are set for the file.
  156.             _______      -regex pattern
  157.                                               _______            Pathname matches regular expression pattern.
  158.            _          -size n[ck]
  159.                     _                                       _            File uses n 512-byte blocks (bytes if `c' follows n,
  160.                                    _                                     kilobytes if `k' follows n). The size does not count
  161.           indirect blocks, and does count blocks in sparse files
  162.           that are not actually allocated.
  163.      -true
  164.           Always true.
  165.            _      -type c
  166.                           _            File is of type c:
  167.           b block (buffered) character
  168.           c character (unbuffered) character
  169.           d directory
  170.           p named pipe (FIFO)
  171.           f regular file
  172.           l symbolic link
  173.           s socket
  174.           _      -uid n
  175.                                     _            File's numeric user ID is n.
  176.            _      -used n
  177.                                  _                                          File was last accessed n days after its status was last
  178.           changed.
  179.            _____      -user uname
  180.                                 _____                                      File is owned by user uname (numeric user ID allowed).
  181.             _      -xtype c
  182.           The same as -type unless the file is a symbolic link.
  183.           For symbolic links, if -follow has not been given, true
  184.                                                   _                       if the file is a link to a file of type c; if -follow
  185.                                   _                                       has been given, true if c is `l'. For symbolic links,
  186.           -xtype checks the type of the file that -type does not
  187.           check.
  188.      ACTIONS
  189.            _______        -exec command ;
  190. Page 4
  191. FIND(1L) FIND(1L)
  192.                   _______                                               Execute command; true if 0 status is returned.  All
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.           following arguments to find are taken to be arguments
  206.           to the command until an argument consisting of `;' is
  207.           encountered.  The string `{}' is replaced by the
  208.           current pathname being processed everywhere it occurs
  209.           in the arguments to the command.  Both of these con-
  210.           structions might need to be escaped (with a `║) or
  211.           quoted to protect them from expansion by the shell.
  212.              ____      -fprint file
  213.                                                   ____     ____           True; print the full pathname into file file. If file
  214.           does not exist when find is run, it is created; if it
  215.           does exist, it is truncated.  The filenames
  216.           ``/dev/stdout'' and ``/dev/stderr'' are handled spe-
  217.           cially; they refer to the standard output and standard
  218.           error output, respectively.
  219.               ____      -fprint0 file
  220.                                           ____                         True; like -print0 but write to file like -fprint.
  221.               ____ ______      -fprintf file format
  222.                                           ____                         True; like -printf but write to file like -fprint.
  223.          _______        -ok command ;
  224.           Like -exec but ask user first; if the response does not
  225.           start with `y' or `Y', do not run the command, and
  226.           return false.
  227.      -print
  228.           True; print the full pathname on the standard output,
  229.           followed by a newline.
  230.      -print0
  231.           True; print the full pathname on the standard output,
  232.           followed by a null character.  This allows filenames
  233.           that contain newlines to be correctly interpreted by
  234.           programs that process the find output.
  235.              ______      -printf format
  236.                       ______                                                True; print format on the standard output, interpreting
  237.           `║ escapes and `%' directives.  Field widths and pre-
  238.           cisions can be specified as with the `printf' C func-
  239.           tion.  The escapes and directives are:
  240.           Alarm bell.
  241.           Backspace.
  242.           Stop printing from this format immediately.
  243.           Form feed.
  244. Page 5
  245. FIND(1L) FIND(1L)
  246.           Newline.
  247.           Carriage return.
  248.           Horizontal tab.
  249.           Vertical tab.
  250.           A `║ character followed by any other character is
  251.           treated as an ordinary character, so they both are
  252.           printed.
  253.           %% A literal percent sign.
  254.           %a File's last access time in the format returned by
  255.                the C `ctime' function.
  256.             _                                                              %Ak File's last access time in the format specified by
  257.                _                                                              k, which is either `@' or a directive for the C
  258.                                                              _                `strftime' function.  The possible values for k
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.                are listed below; some of them might not be avail-
  272.                able on all systems, due to differences in
  273.                `strftime' between systems.
  274.                @ seconds since Jan. 1, 1970, 00:00 GMT.
  275.                Time fields:
  276.                H hour (00..23)
  277.                I hour (00..12)
  278.                M minute (00..59)
  279.                p locale's AM or PM
  280.                r time, 12-hour (hh:mm:ss [AP]M)
  281.                S second (00..61)
  282.                T time, 24-hour (hh:mm:ss)
  283.                X locale's time representation (H:M:S)
  284.                Z time zone (e.g., EDT), or nothing if no time
  285.                     zone is determinable
  286.                Date fields:
  287.                a locale's abbreviated weekday name (Sun..Sat)
  288.                A locale's full weekday name, variable length
  289. Page 6
  290. FIND(1L) FIND(1L)
  291.                     (Sunday..Saturday)
  292.                b locale's abbreviated month name (Jan..Dec)
  293.                B locale's full month name, variable length
  294.                     (January..December)
  295.                c locale's date and time (Sat Nov 04 12:02:33
  296.                     EST 1989)
  297.                d day of month (01..31)
  298.                D date (mm/dd/yy)
  299.                h same as b
  300.                j day of year (001..366)
  301.                m month (01..12)
  302.                U week number of year with Sunday as first day
  303.                     of week (00..53)
  304.                w day of week (0..6)
  305.                W week number of year with Monday as first day
  306.                     of week (00..53)
  307.                x locale's date representation (mm/dd/yy)
  308.                y last two digits of year (00..99)
  309.                Y year (1970...)
  310.           %b File's size in 512-byte blocks (rounded up).
  311.           %c File's last status change time in the format
  312.                returned by the C `ctime' function.
  313.             _                                                        %Ck File's last status change time in the format
  314.                             _                                              specified by k, which is the same as for %A.
  315.           %d File's depth in the directory tree; 0 means the
  316.                file is a command line argument.
  317.           %f File's pathname with any leading directories
  318.                removed.
  319.           %g File's group name, or numeric group ID if the
  320.                group has no name.
  321.           %G File's numeric group ID.
  322. Page 7
  323. FIND(1L) FIND(1L)
  324.           %h Leading directories of file's pathname.
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.           %H Command line argument under which file was found.
  338.           %i File's inode number (in decimal).
  339.           %k File's size in 1K blocks (rounded up).
  340.           %l Object of symbolic link (empty string if file is
  341.                not a symbolic link).
  342.           %m File's permission bits (in octal).
  343.           %n Number of hard links to file.
  344.           %p File's pathname.
  345.           %P File's pathname with the name of the command line
  346.                argument under which it was found removed.
  347.           %s File's size in bytes.
  348.           %t File's last modification time in the format
  349.                returned by the C `ctime' function.
  350.             _                                                              %Tk File's last modification time in the format speci-
  351.                        _                                              fied by k, which is the same as for %A.
  352.           %u File's user name, or numeric user ID if the user
  353.                has no name.
  354.           %U File's numeric user ID.
  355.           A `%' character followed by any other character is dis-
  356.           carded (but the other character is printed).
  357.      -prune
  358.           If -depth is not given, true; do not descend the
  359.           current directory.
  360.           If -depth is given, false; no effect.
  361.      -ls True; list current file in `ls -dils' format on stan-
  362.           dard output.  The block counts are of 1K blocks, unless
  363.           the environment variable POSIX_ME_HARDER is set, in
  364.           which case 512-byte blocks are used.
  365.      OPERATORS
  366.      Listed in order of decreasing precendence:
  367.        ____        ( expr )
  368.           Force precedence.
  369. Page 8
  370. FIND(1L) FIND(1L)
  371.         ____      !  expr
  372.                   ____                     True if expr is false.
  373.           ____      -not expr
  374.                      ____            Same as !  expr.
  375.      _____ _____      expr1 expr2
  376.                          _____                     _____              And (implied); expr2 is not evaluated if expr1 is
  377.           false.
  378.      _____    _____      expr1 -a expr2
  379.                   _____ _____            Same as expr1 expr2.
  380.      _____      _____      expr1 -and expr2
  381.                   _____ _____            Same as expr1 expr2.
  382.      _____    _____      expr1 -o expr2
  383.               _____                     _____                    Or; expr2 is not evaluated if expr1 is true.
  384.      _____     _____      expr1 -or expr2
  385.                   _____    _____            Same as expr1 -o expr2.
  386.      _____   _____      expr1 , expr2
  387.                      _____     _____                                      List; both expr1 and expr2 are always evaluated.  The
  388.                    _____                                                  value of expr1 is discarded; the value of the list is
  389.                        _____            the value of expr1.
  390. Page 9
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.